package com.smedi.ismedi.database.starter.interceptor.permission;


import java.util.List;

/**
 * @Author: xulinjun
 * @Date: 2021-6-9 13:42
 */
public enum SqlItemEnum {
    /**
     * 创建人字段
     */
    author("author", "created_user_id", Long.class),

    /**
     * 企业组织字段
     */
    hrOrganization("hrOrganization", "hr_organization_id", List.class),

    /**
     * 项目组织字段
     */
    projectOrganization("projectOrganization", "project_organization_id", List.class),

    /**
     * 项目字段
     */
    project("project", "project_id", List.class);

    private String value;

    private String field;

    private Class clazz;

    SqlItemEnum(String value, String field, Class clazz) {
        this.value = value;
        this.field = field;
        this.clazz = clazz;
    }

    public static String getField(String value) {
        for (SqlItemEnum c : SqlItemEnum.values()) {
            if (c.getValue().equals(value)) {
                return c.field;
            }
        }
        return null;
    }

    public static Class getClass(String value) {
        for (SqlItemEnum c : SqlItemEnum.values()) {
            if (c.getValue().equals(value)) {
                return c.clazz;
            }
        }
        return null;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public String getField() {
        return field;
    }

    public void setField(String field) {
        this.field = field;
    }

    public Class getClazz() {
        return clazz;
    }

    public void setClazz(Class clazz) {
        this.clazz = clazz;
    }
}
